%% currently yields compile time ect error

-include_lib("ect/include/ect.hrl").
-class(fun_shadow).
?FIELDS(1, public, {a, b, c = c_val}).
-export([dotest/0]).

nonoop_test() ->
    Var = xxx,
    A1 = Var,
    A2 = yyy,
    F = fun(A1) -> okay; (_) -> error end,
    okay = F(A1),
    okay = F(A2),
    pass.

body_test() ->
    Z1 = atom1,
    X = fun() -> Z1 end,
    atom1 = X(),
    pass.

dotest() ->
    pass = nonoop_test(),
    pass = body_test(),

    Var = xxx,
    Var2 = var2val,
    A1 = #fun_shadow{a = Var},
    B1 = #fun_shadow{a = yyy},
    F = fun(#fun_shadow{a = Var, b = B, c = Var2}) when Var2 =:= c_val ->
            'Var2' = list_to_atom("Var2"),  % test if fast_transform messes this up
            {okay, Var};
           (_) -> error
        end,
    {okay, xxx} = F(A1),
    {okay, yyy} = F(B1),
    pass.